package 查找.树.普通树;

import java.util.LinkedList;
import java.util.List;

public class Main1 {

    public static void main(String[] args) {

        TreeNode treeRoot = new TreeNode(8, null);
        TreeNode treeNode2 = new TreeNode(3, treeRoot);
        TreeNode treeNode3 = new TreeNode(1, treeNode2);
        TreeNode treeNode4 = new TreeNode(6, treeNode2);
        TreeNode treeNode5 = new TreeNode(4, treeNode4);
        TreeNode treeNode6 = new TreeNode(7, treeNode4);
        TreeNode treeNode7 = new TreeNode(10, treeRoot);
        TreeNode treeNode8 = new TreeNode(14, treeNode7);
        TreeNode treeNode9 = new TreeNode(13, treeNode8);

        List<TreeNode> childTreeNodes1 = new LinkedList<>();
        childTreeNodes1.add(treeNode2);
        childTreeNodes1.add(treeNode7);
        treeRoot.setChildTree(childTreeNodes1);

        List<TreeNode> childTreeNodes2 = new LinkedList<>();
        childTreeNodes2.add(treeNode3);
        childTreeNodes2.add(treeNode4);
        treeNode2.setChildTree(childTreeNodes2);

        List<TreeNode> childTreeNodes3 = new LinkedList<>();
        childTreeNodes3.add(treeNode5);
        childTreeNodes3.add(treeNode6);
        treeNode4.setChildTree(childTreeNodes3);

        List<TreeNode> childTreeNodes4 = new LinkedList<>();
        childTreeNodes4.add(treeNode8);
        treeNode7.setChildTree(childTreeNodes4);

        List<TreeNode> childTreeNodes5 = new LinkedList<>();
        childTreeNodes5.add(treeNode9);
        treeNode8.setChildTree(childTreeNodes5);

        treeRoot.iterate(treeRoot);
    }
}
